<div class="da-list-wrap">
  <div class="da-content-wrapper">
    <d-row [dGutter]="[12, 12]">
      <d-col [dSpan]="24" [dFlex]="24">
        <div class="da-list-container">
          <div class="da-list-header">
            <div class="da-header-left">
              <d-row [dSpace]="12" [dSpaceDirection]="'horizontal'" [dAlign]="'center'">
                <d-col>
                  <div class="da-header-item-label">{{ 'stdata.dataSetTypeCode' | translate }}:</div>
                </d-col>
                <d-col>
                  <input dTextInput name="dataSetTypeCode" [(ngModel)]="searchFormConfig.dataSetTypeCode" (keyup.enter)="refreshTable()" />
                </d-col>
                <d-col>
                  <div class="da-header-item-label">{{ 'stdata.dataSetCode' | translate }}:</div>
                </d-col>
                <d-col>
                  <input dTextInput name="dataSetCode" [(ngModel)]="searchFormConfig.dataSetCode" (keyup.enter)="refreshTable()" />
                </d-col>
                <d-col>
                  <div class="da-header-item-label">{{ 'stdata.dataSetValue' | translate }}:</div>
                </d-col>
                <d-col>
                  <input dTextInput name="dataSetValue" [(ngModel)]="searchFormConfig.dataSetValue" (keyup.enter)="refreshTable()" />
                </d-col>
              </d-row>
            </div>
            <div class="header-right">
              <d-button style="margin-right: 8px" bsStyle="primary" (btnClick)="refreshTable()">{{
                'app.common.operate.query.label' | translate
              }}</d-button>
              <d-button bsStyle="common" (btnClick)="reset()">{{ 'app.common.operate.reset.label' | translate }}</d-button>
            </div>
          </div>
        </div>
      </d-col>
    </d-row>

    <d-row [dGutter]="[12, 12]">
      <d-col [dSpan]="10">
        <div class="da-list-container">
          <div class="da-list-header">
            <div class="header-left table-title">
              {{ 'stdata.refdata.type' | translate }}
            </div>
            <div class="header-right">
              <d-button-group>
                <d-button
                  *ngIf="authService.hasPrivilege(PRIVILEGE_CODE.stdataRefDataTypeAdd)"
                  bsStyle="primary"
                  (btnClick)="openAddRefdataTypeDialog()"
                  >{{ 'app.common.operate.new.label' | translate }}</d-button
                >
                <d-button
                  *ngIf="authService.hasPrivilege(PRIVILEGE_CODE.stdataRefDataTypeDelete)"
                  bsStyle="common"
                  (btnClick)="openDeleteRefdataTypeDialog(refdataTypeTable.getCheckedRows())"
                  [disabled]="!refdataTypeTableChecked"
                  >{{ 'app.common.operate.delete.label' | translate }}</d-button
                >
              </d-button-group>
            </div>
          </div>
          <div class="list-content" id="refdataTypeContent">
            <d-data-table
              #refdataTypeTable
              [dataSource]="refdataTypeTableDs"
              [resizeable]="true"
              [checkable]="true"
              [tableLayout]="'fixed'"
              [scrollable]="true"
              [fixHeader]="true"
              (rowCheckChange)="getRefdataTypeCheckedStatus()"
              (checkAllChange)="getRefdataTypeCheckedStatus()"
              (rowDBClick)="dataTypeRowClick($event.rowItem)"
            >
              <d-column field="dataSetTypeCode" header="{{ 'stdata.dataSetTypeCode' | translate }}" [width]="'200px'" [fixedLeft]="'36px'">
                <d-cell>
                  <ng-template let-cellItem="cellItem">{{ cellItem }}</ng-template>
                </d-cell>
              </d-column>
              <d-column field="dataSetTypeName" header="{{ 'stdata.dataSetTypeName' | translate }}" [width]="'200px'">
                <d-cell>
                  <ng-template let-cellItem="cellItem">{{ cellItem }}</ng-template>
                </d-cell>
              </d-column>
              <d-column field="remark" header="{{ 'stdata.remark' | translate }}" [width]="'160px'">
                <d-cell>
                  <ng-template let-cellItem="cellItem">{{ cellItem }}</ng-template>
                </d-cell>
              </d-column>
              <d-column field="actions" header="{{ 'app.common.operate.label' | translate }}" [width]="'120px'" [fixedRight]="'0px'">
                <d-cell>
                  <ng-template let-rowItem="rowItem" let-rowIndex="rowIndex">
                    <div class="btn-group over-flow-ellipsis">
                      <d-button
                        *ngIf="authService.hasPrivilege(PRIVILEGE_CODE.stdataRefDataTypeEdit)"
                        icon="icon-edit"
                        bsStyle="text-dark"
                        (btnClick)="openEditRefdataTypeDialog(rowItem)"
                        title="{{ 'app.common.operate.edit.label' | translate }}"
                      ></d-button>
                      <d-button
                        *ngIf="authService.hasPrivilege(PRIVILEGE_CODE.stdataRefDataTypeDelete)"
                        icon="icon-delete"
                        bsStyle="text-dark"
                        (btnClick)="openDeleteRefdataTypeDialog([rowItem])"
                        title="{{ 'app.common.operate.delete.label' | translate }}"
                      ></d-button>
                    </div>
                  </ng-template>
                </d-cell>
              </d-column>
              <ng-template #noResultTemplateRef>
                <div style="text-align: center; margin-top: 20px">{{ 'app.common.noRecord' | translate }}</div>
              </ng-template>
            </d-data-table>
          </div>
          <div class="da-list-footer">
            <d-pagination
              size=""
              [total]="refdataTypePager.total"
              [(pageSize)]="refdataTypePager.pageSize"
              [(pageIndex)]="refdataTypePager.pageIndex"
              [canViewTotal]="true"
              [canChangePageSize]="true"
              [canJumpPage]="true"
              [maxItems]="5"
              (pageIndexChange)="refreshRefdataTypeTable()"
              (pageSizeChange)="refreshRefdataTypeTable()"
            >
            </d-pagination>
          </div>
        </div>
      </d-col>
      <d-col [dSpan]="14">
        <div class="da-list-container">
          <div class="da-list-header">
            <div class="header-left table-title">
              {{ 'stdata.refdata.data' | translate }}
            </div>
            <div class="header-right">
              <d-button-group>
                <d-button
                  *ngIf="authService.hasPrivilege(PRIVILEGE_CODE.stdataRefDataAdd)"
                  bsStyle="primary"
                  (btnClick)="openAddRefdataDialog()"
                  >{{ 'app.common.operate.new.label' | translate }}</d-button
                >
                <d-button
                  *ngIf="authService.hasPrivilege(PRIVILEGE_CODE.stdataRefDataDelete)"
                  bsStyle="common"
                  (btnClick)="openDeleteRefdataDialog(refataTable.getCheckedRows())"
                  [disabled]="!refdataTableChecked"
                  >{{ 'app.common.operate.delete.label' | translate }}</d-button
                >
              </d-button-group>
            </div>
          </div>
          <div class="list-content" id="refdataContent">
            <d-data-table
              #refDataTable
              [dataSource]="refdataTableDs"
              [resizeable]="true"
              [checkable]="true"
              [tableLayout]="'fixed'"
              [scrollable]="true"
              [fixHeader]="true"
              (rowCheckChange)="getRefdataCheckedStatus()"
              (checkAllChange)="getRefdataCheckedStatus()"
            >
              <d-column field="dataSetType" header="{{ 'stdata.dataSetType' | translate }}" [width]="'240px'" [fixedLeft]="'36px'">
                <d-cell>
                  <ng-template let-cellItem="cellItem">{{ cellItem?.dataSetTypeCode + '-' + cellItem?.dataSetTypeName }}</ng-template>
                </d-cell>
              </d-column>
              <d-column field="dataSetCode" header="{{ 'stdata.dataSetCode' | translate }}" [width]="'160px'">
                <d-cell>
                  <ng-template let-cellItem="cellItem">{{ cellItem }}</ng-template>
                </d-cell>
              </d-column>
              <d-column field="dataSetValue" header="{{ 'stdata.dataSetValue' | translate }}" [width]="'160px'">
                <d-cell>
                  <ng-template let-cellItem="cellItem">{{ cellItem }}</ng-template>
                </d-cell>
              </d-column>
              <d-column field="system" header="{{ 'stdata.system' | translate }}" [width]="'120px'">
                <d-cell>
                  <ng-template let-cellItem="cellItem">{{ cellItem?.systemName }}</ng-template>
                </d-cell>
              </d-column>
              <d-column field="isStandard" header="{{ 'stdata.isStandard' | translate }}" [width]="'80px'">
                <d-cell>
                  <ng-template let-cellItem="cellItem">{{ cellItem?.label }}</ng-template>
                </d-cell>
              </d-column>
              <d-column field="remark" header="{{ 'stdata.remark' | translate }}" [width]="'160px'">
                <d-cell>
                  <ng-template let-cellItem="cellItem">{{ cellItem }}</ng-template>
                </d-cell>
              </d-column>
              <d-column field="actions" header="{{ 'app.common.operate.label' | translate }}" [width]="'120px'" [fixedRight]="'0px'">
                <d-cell>
                  <ng-template let-rowItem="rowItem" let-rowIndex="rowIndex">
                    <div class="btn-group over-flow-ellipsis">
                      <d-button
                        *ngIf="authService.hasPrivilege(PRIVILEGE_CODE.stdataRefDataEdit)"
                        icon="icon-edit"
                        bsStyle="text-dark"
                        (btnClick)="openEditRefdataDialog(rowItem)"
                        title="{{ 'app.common.operate.edit.label' | translate }}"
                      ></d-button>
                      <d-button
                        *ngIf="authService.hasPrivilege(PRIVILEGE_CODE.stdataRefDataDelete)"
                        icon="icon-delete"
                        bsStyle="text-dark"
                        (btnClick)="openDeleteRefdataDialog([rowItem])"
                        title="{{ 'app.common.operate.delete.label' | translate }}"
                      ></d-button>
                    </div>
                  </ng-template>
                </d-cell>
              </d-column>
              <ng-template #noResultTemplateRef>
                <div style="text-align: center; margin-top: 20px">{{ 'app.common.noRecord' | translate }}</div>
              </ng-template>
            </d-data-table>
          </div>
          <div class="da-list-footer">
            <d-pagination
              size=""
              [total]="refdataPager.total"
              [(pageSize)]="refdataPager.pageSize"
              [(pageIndex)]="refdataPager.pageIndex"
              [canViewTotal]="true"
              [canChangePageSize]="true"
              [canJumpPage]="true"
              [maxItems]="5"
              (pageIndexChange)="refreshRefdataTable()"
              (pageSizeChange)="refreshRefdataTable()"
            >
            </d-pagination>
          </div>
        </div>
      </d-col>
    </d-row>
  </div>
</div>
